const express = require("express");
const path = require("path");
const { hlog } = require("./utils");

const app = express();

app.use(express.json());

// 请求 http://localhost:9000 时，会在静态资源文件夹找到 index.html 并返回
// 不会输出 hello world
app.use(express.static(path.join(__dirname, "../client")));

app.use((req, res) => {
    hlog(req.method, req.url);
    res.send("Hello World");
});

app.listen(9000, () => {
    console.log("Server is running on port http://localhost:9000");
});
